package cn.e3.fastdfs;

import java.io.FileNotFoundException;
import java.io.IOException;

import org.csource.common.MyException;
import org.csource.fastdfs.ClientGlobal;
import org.csource.fastdfs.StorageClient;
import org.csource.fastdfs.StorageServer;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;


public class FastDfs {
	
	public void test_1() throws FileNotFoundException, IOException, MyException{
		//创建配置文件，为tracker服务器的地址
		//使用全局对象加载配
		ClientGlobal.init("F:\\workspace\\e3_web\\src\\main\\resources\\fastdfs\\client.conf");
		//创建tranckerclient对象
		TrackerClient trackerClient=new TrackerClient();
		//获得trackerserver对象
		TrackerServer trackerServer = trackerClient.getConnection();
		//创建storeage对象。除湿为null
		StorageServer storageServer=null;
		//创建storeageclient对象,绑定t和s
		StorageClient storageClient=new StorageClient(trackerServer, storageServer);
		//使用storageClient上传图片
		String[] file = storageClient.upload_file("C:\\Users\\CZK\\Desktop\\kd.jpg", "jpg", null);
		for (String string : file) {
			System.out.println(string);
		}
		//访问图片是由其中的nginx虚拟机来访问，fastdfs只是起到存储图片的作用
	}
}	
